# Contributor: Díaz Urbaneja Diego <sodomon2@gmail.com>
# Maintainer: Díaz Urbaneja Diego <sodomon2@gmail.com>
pkgname=sqlitebrowser
pkgver=3.13.1
pkgrel=0
pkgdesc="GUI editor for sqlite databases"
url="https://sqlitebrowser.org/"
arch="all"
license="GPL-3.0-only"
makedepends="
	cmake
	qscintilla-dev
	qt5-qtbase-dev
	qt5-qttools-dev
	samurai
	sqlite-dev
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/sqlitebrowser/sqlitebrowser/archive/v$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		local crossopts="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DENABLE_TESTING="$(want_check && echo ON || echo OFF)" \
		$crossopts
	cmake --build build
}

check() {
	ctest --output-on-failure --test-dir build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
7482094823293a216e4df20105d1351a23fcc706fd9e64bca58cd1c6a46dcf639a945f919613f1a9550d0a15e60a4c2827ee5eee4f89a7b11046d8eefbf375ee  sqlitebrowser-3.13.1.tar.gz
"
